<?php
namespace app\common\business;

use app\common\model\mysql\Demo as demoModel;
// 业务层 处理数据组装
class Demo {

	public function getDemoDataByCatId($cat_id,$limit=10){
		$demoModel = new demoModel();
		$result = $demoModel->getDemoDataByCatId($cat_id,$limit);
		if(empty($result)){
			//return show(config('status.success'),'数据为空');
			return [];
		}

		$category = config('category');
		foreach($result as &$row){
			$row['cat_name'] = $category[$row['cat_id']] ?? '其它';
		}

		return $result;
	}
}